﻿namespace Rio.Manager.Application
{
    using System;
    using System.Collections.Generic;
    using System.ServiceModel.DomainServices.Client;
    using System.Windows;

    using GalaSoft.MvvmLight.Threading;

    using NetBay.Core.BusinessEntities;
    using NetBay.Core.Silverlight.Extensions;

    using Rio.Applications.Web.Services;
    using Rio.Applications.Web.Services.BusinessEntities;
    using Rio.Framework.Localisation;
    using Rio.Framework.Pages;
    using Rio.Framework.Pages.Context;
    using Rio.Framework.WCFService;
    using Rio.Manager.Application.ViewModel.Locator;
    using Telerik.Windows.Controls;

    public partial class App : Application
    {
        #region Constructors

        public App()
        {
            Exit += Application_Exit;
         
            InitializeComponent();

            DispatcherHelper.Initialize();
        }

        #endregion Constructors

        #region Methods

        protected void InitializeRootVisual(object sender, EventArgs e)
        {
            RootVisual = new MainPage();
        }

        /// <summary>
        /// The application end
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Application_Exit(object sender, EventArgs e)
        {
            ViewModelLocator.Cleanup();
        }
        
        #endregion Methods
    }
}